2002-10-30 19:51:16

by Matt Domsch

[permalink] [raw]
Subject: Re: [BK PATCH 2.5.44] EDD updates 3/4

You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2002-10-24 16:22:00-05:00, [email protected]
EDD: moved attr_test to edd_attribute ->test(), comments


edd.c | 85 ++++++++++++++++++++++++++++--------------------------------------
1 files changed, 37 insertions, 48 deletions


diff -Nru a/arch/i386/kernel/edd.c b/arch/i386/kernel/edd.c
--- a/arch/i386/kernel/edd.c Thu Oct 24 16:22:38 2002
+++ b/arch/i386/kernel/edd.c Thu Oct 24 16:22:38 2002
@@ -26,9 +26,6 @@

/*
* Known issues:
- * - module unload leaves directories around if a symlink was
- * created in that directory. Confirmed is a driverfs bug, not
- * ours. Seen on kernel 2.5.41.
* - refcounting of struct device objects could be improved.
*
* TODO:
@@ -60,7 +57,7 @@
MODULE_DESCRIPTION("driverfs interface to BIOS EDD information");
MODULE_LICENSE("GPL");

-#define EDD_VERSION "0.06 2002-Oct-09"
+#define EDD_VERSION "0.07 2002-Oct-24"
#define EDD_DEVICE_NAME_SIZE 16
#define REPORT_URL "http://domsch.com/linux/edd30/results.html"

@@ -86,6 +83,7 @@
struct attribute attr;
ssize_t(*show) (struct edd_device * edev, char *buf, size_t count,
loff_t off);
+ int (*test) (struct edd_device * edev);
};

/* forward declarations */
@@ -95,10 +93,11 @@

static struct edd_device *edd_devices[EDDMAXNR];

-#define EDD_DEVICE_ATTR(_name,_mode,_show) \
+#define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \
struct edd_attribute edd_attr_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \
+ .test = _test, \
};

static inline struct edd_info *
@@ -505,17 +504,6 @@
return (p - buf);
}

-static EDD_DEVICE_ATTR(raw_data, 0444, edd_show_raw_data);
-static EDD_DEVICE_ATTR(version, 0444, edd_show_version);
-static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions);
-static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags);
-static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders);
-static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads);
-static EDD_DEVICE_ATTR(default_sectors_per_track, 0444,
- edd_show_default_sectors_per_track);
-static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors);
-static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface);
-static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus);

/*
* Some device instances may not have all the above attributes,
@@ -525,16 +513,7 @@
* if the default_{cylinders,heads,sectors_per_track} values
* are zero, the BIOS doesn't provide sane values, don't bother
* creating files for them either.
- *
- * struct attr_test pairs an attribute and a test,
- * (the default NULL test being true - the attribute exists)
- * and individual existence tests may be written for each
- * attribute.
*/
-struct attr_test {
- struct edd_attribute *attr;
- int (*test) (struct edd_device * edev);
-};

static int
edd_has_default_cylinders(struct edd_device *edev)
@@ -591,23 +570,34 @@
return 0;
}

-static struct attr_test def_attrs[] = {
- {.attr = &edd_attr_raw_data},
- {.attr = &edd_attr_version},
- {.attr = &edd_attr_extensions},
- {.attr = &edd_attr_info_flags},
- {.attr = &edd_attr_sectors},
- {.attr = &edd_attr_default_cylinders,
- .test = &edd_has_default_cylinders},
- {.attr = &edd_attr_default_heads,
- .test = &edd_has_default_heads},
- {.attr = &edd_attr_default_sectors_per_track,
- .test = &edd_has_default_sectors_per_track},
- {.attr = &edd_attr_interface,
- .test = &edd_has_edd30},
- {.attr = &edd_attr_host_bus,
- .test = &edd_has_edd30},
- {.attr = NULL,.test = NULL},
+static EDD_DEVICE_ATTR(raw_data, 0444, edd_show_raw_data, NULL);
+static EDD_DEVICE_ATTR(version, 0444, edd_show_version, NULL);
+static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, NULL);
+static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, NULL);
+static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, NULL);
+static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders,
+ edd_has_default_cylinders);
+static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads,
+ edd_has_default_heads);
+static EDD_DEVICE_ATTR(default_sectors_per_track, 0444,
+ edd_show_default_sectors_per_track,
+ edd_has_default_sectors_per_track);
+static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface, edd_has_edd30);
+static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus, edd_has_edd30);
+
+
+static struct edd_attribute * def_attrs[] = {
+ &edd_attr_raw_data,
+ &edd_attr_version,
+ &edd_attr_extensions,
+ &edd_attr_info_flags,
+ &edd_attr_sectors,
+ &edd_attr_default_cylinders,
+ &edd_attr_default_heads,
+ &edd_attr_default_sectors_per_track,
+ &edd_attr_interface,
+ &edd_attr_host_bus,
+ NULL,
};

/* edd_get_devpath_length(), edd_fill_devpath(), and edd_device_link()
@@ -864,14 +854,13 @@
static int
edd_populate_dir(struct edd_device *edev)
{
- struct attr_test *s;
+ struct edd_attribute *attr;
int i;
int error = 0;

- for (i = 0; def_attrs[i].attr; i++) {
- s = &def_attrs[i];
- if (!s->test || (s->test && !s->test(edev))) {
- if ((error = edd_create_file(edev, s->attr))) {
+ for (i = 0; (attr=def_attrs[i]); i++) {
+ if (!attr->test || (attr->test && !attr->test(edev))) {
+ if ((error = edd_create_file(edev, attr))) {
break;
}
}
@@ -926,7 +915,7 @@
edd_init(void)
{
unsigned int i;
- int rc;
+ int rc=0;
struct edd_device *edev;

printk(KERN_INFO "BIOS EDD facility v%s, %d devices found\n",

===================================================================


This BitKeeper patch contains the following changesets:
1.812
## Wrapped with gzip_uu ##


begin 664 bkpatch21214
M'XL(`)]DN#T``[56VV[;.!!]%K]BM@$"._&%I*YVX*)M%.P:FVV"M.G+IA!H
MB;:$Z!)(5-)@]?%+RC<ELEULT)4,TIP9GN$,#X<Z@MN"YV/M+R:$YV9)X8?H
M"/[("C'6`A['`S]+I.`FRZ1@&&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/Z37&#S$WQFJ%-V2ZRM;5K=K0UNW:ON9!UJIO23=:0ILY*#[F.9:NJ
MM^RTW0E3?V5]=&PBJ];4L0U9C[5YED,GDOG#9]!1%I-M6J/OW3.(3D^[*KE:
M-(?.;TJQO%N@JI835L/C8VAH.W4U[BYGUE,[/,^EKTF]*C_G3'!O'L6\MNS5
KM]C2WAW)FT)5\+JKZW[N3_#9]BO6#[E_7Y3)A'`2F#JWT+^*==<$+0L`````
`
end

--
Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions http://www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com



2002-10-30 21:35:47

by Matt Domsch

[permalink] [raw]
Subject: Re: [BK PATCH 2.5.44] EDD updates 3/4

Resend, with right patch #3 of 4.
-Matt

You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2002-10-23 11:25:28-05:00, [email protected]
EDD: remove list_head from edd_device, don't delete symlinks

Update comments
Remove list_head from edd_device, don't delete it
Don't delete symlinks - driverfs_remove_dir() will.


edd.c | 11 +++--------
1 files changed, 3 insertions, 8 deletions


diff -Nru a/arch/i386/kernel/edd.c b/arch/i386/kernel/edd.c
--- a/arch/i386/kernel/edd.c Wed Oct 23 13:16:00 2002
+++ b/arch/i386/kernel/edd.c Wed Oct 23 13:16:00 2002
@@ -26,14 +26,13 @@

/*
* Known issues:
- * - module unload leaves a directory around. Seems related to
- * creating symlinks in that directory. Seen on kernel 2.5.41.
+ * - module unload leaves directories around if a symlink was
+ * created in that directory. Confirmed is a driverfs bug, not
+ * ours. Seen on kernel 2.5.41.
* - refcounting of struct device objects could be improved.
*
* TODO:
* - Add IDE and USB disk device support
- * - when driverfs model of discs and partitions changes,
- * update symlink accordingly.
* - Get symlink creator helper functions exported from
* drivers/base instead of duplicating them here.
* - move edd.[ch] to better locations if/when one is decided
@@ -80,7 +79,6 @@
struct edd_device {
char name[EDD_DEVICE_NAME_SIZE];
struct edd_info *info;
- struct list_head node;
struct driver_dir_entry dir;
};

@@ -860,10 +858,7 @@
static inline void
edd_device_unregister(struct edd_device *edev)
{
- driverfs_remove_file(&edev->dir, "pci_dev");
- driverfs_remove_file(&edev->dir, "disc");
driverfs_remove_dir(&edev->dir);
- list_del_init(&edev->node);
}

static int

===================================================================


This BitKeeper patch contains the following changesets:
1.811
## Wrapped with gzip_uu ##


begin 664 bkpatch19598
M'XL(`&#GMCT``\54;6O;,!#^'/V*@W[86VWKQ6\Q9'2KRS:VL9+2ST&QE-K$
MMHJD)"OXQ^^2K-G8LD%+QVQA?*>[T_/</>@$KIVVQ>BS]'Y6FLY5-3F!]\;Y
M8J1TVX:5Z=`Q-08=46TZ'75J%Q;-EU';]*NO`0^30"L5>+.U'<'X2^FK&M;:
MNF+$0G'P^+M;78RF%^^N/[V9$C*9P'DM^QM]I3U,)L0;NY:M<F?2UZWI0V]E
M[SKMY1;&<`@=.*4<WX1E@B;IP%(:9T/%%&,R9EI1'N=I3'[B=';/Y9<BC'+!
M4I8G?.`B%XR4P,*<,:`\8C3B`A@K>%+P/*!)02D<JPFO&`24O(6GA7].*K@H
MRP*L[LQ:0]LX/ZNU5+"P>"AV?*;TNJGT*2C3/_.`>+37X.XZG,/283JNZULE
MT8D`.MW[K7/ZL'*-QYSRV`$0@+(-#GGA9GN,,]78YR]@TV!CR$?`EO*$7/Z8
M,0D>^!!")26OC[9]D!95V(@\C9;:]KJ-D$-8?9\K'7/*1!(/+.%9/(S3=)PM
M%ME<*K'(9/6(BENE\(2+(4DR&N_$>SQ^J^0G!_R(BGMIH[1H3K-X)^WX-V&+
MOPI;0)#_$V'_3UGNY_<%`KO9+939Y1]&^0C!EGP,G'P0%`2!EPBF,VK5:ECU
MK4%6K99K[0`1Z0K;VN"_M&;5*V@6(.])P$:Z;39`934V"G=[\+7TA\2[$.#<
M](O&=MM=K')@#?/5S2GTQN\KF)5U&'RE=0^FAST]P$L[C%E(2I$@W#)'0>`W
?%3LC3=$Z7-I5K:NE6W433F4VUV--O@%=[TW6-@8`````
`
end