diff options
author | David Zeuthen <david@fubar.dk> | 2005-01-20 17:03:54 +0000 |
---|---|---|
committer | David Zeuthen <david@fubar.dk> | 2005-01-20 17:03:54 +0000 |
commit | 0fe6a6ddd80f6d104df6b883a9140c0ff32772e6 (patch) | |
tree | b78fbf3ab95d6ec3d9a2207ea220bf62cd3e2139 | |
parent | 555d8f0555469bff4e23aba77916aaff5d585027 (diff) |
Update for 0.4.6HAL_0_4_6
Bump to 0.4.6
Add stopgap fix to not free unallocated memory. This is a *workaround* to
not make hald crash on some PPC hardware. Reported by Joseph E. Sacco,
Ph.D. <joseph_sacco@comcast.net> who helped test this.
Add mount option iocharset=utf8 for vfat volumes
Update libsysfs to upstream version 1.2.0
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | NEWS | 14 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | doc/spec/hal-spec.html | 8 | ||||
-rw-r--r-- | fdi/90defaultpolicy/storage-policy.fdi | 5 | ||||
-rw-r--r-- | hald/linux/libsysfs/dlist.c | 264 | ||||
-rw-r--r-- | hald/linux/libsysfs/dlist.h | 11 | ||||
-rw-r--r-- | hald/linux/libsysfs/sysfs.h | 1 | ||||
-rw-r--r-- | hald/linux/libsysfs/sysfs_dir.c | 7 | ||||
-rw-r--r-- | hald/linux/pci_bus_device.c | 2 |
10 files changed, 325 insertions, 11 deletions
@@ -1,3 +1,23 @@ +2005-01-20 David Zeuthen <davidz@redhat.com> + + * NEWS: Update for 0.4.6 + + * configure.in: Bump to 0.4.6 + +2005-01-20 David Zeuthen <davidz@redhat.com> + + * hald/linux/libsysfs/sysfs_dir.c (sysfs_close_attribute): Add + stopgap fix to not free unallocated memory. This is a *workaround* + to not make hald crash on some PPC hardware. Reported by Joseph + E. Sacco, Ph.D. <joseph_sacco@comcast.net> who helped test this. + + * fdi/90defaultpolicy/storage-policy.fdi: Add mount option + iocharset=utf8 for vfat volumes + +2005-01-20 David Zeuthen <davidz@redhat.com> + + * hald/linux/libsysfs: Update libsysfs to upstream version 1.2.0 + 2005-01-17 David Zeuthen <davidz@redhat.com> * hald/linux/net_class_device.c (mii_get_rate): Add debug statements @@ -1,5 +1,19 @@ ========== +HAL 0.4.6 "It can only be attributable to human error." +========== + +Released Jan 20, 2005 + + - Fix strange crasher in libsysfs on certain ppc platforms + - Update local libsysfs copy to 1.2.0 + - Add compile time option to use 2.6.10 link detection features rather + than talking directly to the mii registers + - Fix off by one in VFAT label probing (Kay Sievers) + - Skip NTFS signed volume and label probing fixes (Kay Sievers) + - Use mount option iocharset=utf8 for vfat volumes + +========== HAL 0.4.5 "It's going to go 100% failure in 72 hours." ========== diff --git a/configure.in b/configure.in index e340bc94..e97fe2f3 100644 --- a/configure.in +++ b/configure.in @@ -1,8 +1,8 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT(hal, 0.4.5, david@fubar.dk) -AM_INIT_AUTOMAKE(hal, 0.4.5) +AC_INIT(hal, 0.4.6, david@fubar.dk) +AM_INIT_AUTOMAKE(hal, 0.4.6) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/doc/spec/hal-spec.html b/doc/spec/hal-spec.html index 6df80e02..c059c566 100644 --- a/doc/spec/hal-spec.html +++ b/doc/spec/hal-spec.html @@ -2,7 +2,7 @@ <HTML ><HEAD ><TITLE ->HAL 0.4.5 Specification</TITLE +>HAL 0.4.6 Specification</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD @@ -24,7 +24,7 @@ CLASS="TITLEPAGE" CLASS="title" ><A NAME="AEN2" ->HAL 0.4.5 Specification</A +>HAL 0.4.6 Specification</A ></H1 ><H3 CLASS="author" @@ -51,7 +51,7 @@ HREF="mailto:david@fubar.dk" ></DIV ><SPAN CLASS="releaseinfo" ->Version 0.4.5<BR></SPAN +>Version 0.4.6<BR></SPAN ><HR></DIV ><DIV CLASS="TOC" @@ -634,7 +634,7 @@ CLASS="CALSTABLE" ></TR ><TR ><TD ->0.4.5</TD +>0.4.6</TD ><TD > </TD ><TD diff --git a/fdi/90defaultpolicy/storage-policy.fdi b/fdi/90defaultpolicy/storage-policy.fdi index 2194d4dd..29f26290 100644 --- a/fdi/90defaultpolicy/storage-policy.fdi +++ b/fdi/90defaultpolicy/storage-policy.fdi @@ -163,6 +163,11 @@ <merge key="volume.policy.mount_option.noatime" type="bool">true</merge> </match> </match> + + <!-- Use UTF-8 charset for vfat --> + <match key="volume.fstype" string="vfat"> + <merge key="volume.policy.mount_option.iocharset=utf8" type="bool">true</merge> + </match> <!-- whitelist of partition table id's, if from a msdos partition table --> <match key="volume.partition.msdos_part_table_type" exists="true"> diff --git a/hald/linux/libsysfs/dlist.c b/hald/linux/libsysfs/dlist.c index a324624b..5f2c00be 100644 --- a/hald/linux/libsysfs/dlist.c +++ b/hald/linux/libsysfs/dlist.c @@ -206,6 +206,46 @@ void *dlist_insert(Dlist *list,void *data,int direction) return(list->marker->data); } +/* internal use only + * Insert dl_node at marker. + * If direction true it inserts after. + * If direction false it inserts before. + * move marker to inserted node + * return pointer to inserted node + */ +void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction) +{ + if(list==NULL || new_node==NULL) + return(NULL); + if(list->marker==NULL) //in case the marker ends up unset + list->marker=list->head; + list->count++; + if(list->head->next==NULL) + { + list->head->next=list->head->prev=new_node; + new_node->prev=list->head; + new_node->next=list->head; + } + else if(direction) + { + new_node->next=list->marker->next; + new_node->prev=list->marker; + list->marker->next->prev=new_node; + list->marker->next=new_node; + } + else + { + new_node->prev=list->marker->prev; + new_node->next=list->marker; + list->marker->prev->next=new_node; + list->marker->prev=new_node; + } + list->marker=new_node; + return(list->marker); +} + + + /* * Remove DL_node from list without deallocating data. * if marker == killme . @@ -238,6 +278,54 @@ void *_dlist_remove(Dlist *list,DL_node *killme,int direction) return (NULL); } +/* + * move dl_node from source to dest + * if marker == target . + * when direction true it moves marker after + * when direction false it moves marker before. + * to previous if there is no next. + */ +void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction) +{ + + if(target!=NULL) + { + if(target==source->head) + { + //not even going to try + } + else + { + // take care of head and marker pointers. + if(source->marker==target) + _dlist_mark_move(source,direction); + if(target ==source->head->next) + source->head->next=target->next; + if(target==source->head->prev) + source->head->prev=target->prev; + // remove from list + if(source->count==1) + { + target->prev=NULL; + target->next=NULL; + source->head->next=NULL; + source->head->prev=NULL; + } + else + { + if(target->prev !=NULL) + target->prev->next=target->next; + if(target->next !=NULL) + target->next->prev=target->prev; + target->prev=NULL; + target->next=NULL; + } + source->count--; + _dlist_insert_dlnode(dest,target,direction); + } + } +} + /* * Insert node containing data after end. @@ -351,3 +439,179 @@ void *dlist_insert_sorted(struct dlist *list, void *new, int (*sorter)(void *, v list->marker!=list->head && !sorter(new,list->marker->data);dlist_next(list)); return(dlist_insert_before(list,new)); } + +/* + * NOTE: internal use only + */ +int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)) +{ + + struct dl_node *l1head; + struct dl_node *l2head; + struct dl_node *target; + unsigned int l1count=0; + unsigned int l2count=0; + unsigned int mergecount=0; + while(listsource->count>0) + { + l1head=listsource->head->next; + l2head=l1head; + while((l1count<passcount)&&(l2head!=listsource->head)) + { + l2head=l2head->next; + l1count++; + } + // so now we have two lists to merge + + if(l2head==listsource->head) + {// l2count + l2count=0; + } + else + { + l2count=passcount; + } + while(l1count>0 || l2count>0) + { + mergecount++; + if((l2count>0)&&(l1count>0)) + { + // we have things to merge + int result=compare(l1head->data,l2head->data); + if(result>0) + { + // move from l2 + target=l2head; + l2head=l2head->next; + dlist_move(listsource,listdest,target,1); + l2count--; + if(l2head==listsource->head) + l2count=0; + } + else + { + // move from l1 + target=l1head; + l1head=l1head->next; + dlist_move(listsource,listdest,target,1); + l1count--; + } + } + else if(l1count>0) + { + // only have l1 to work with + while(l1count>0) + { + target=l1head; + l1head=l1head->next; + dlist_move(listsource,listdest,target,1); + l1count--; + } + } + else if(l2count>0) + { + // only have l2 to work with + while(l2count>0) + { + if(l2head==listsource->head) + { + l2count=0; + } + else + { + target=l2head; + l2head=l2head->next; + dlist_move(listsource,listdest,target,1); + l2count--; + } + } + } + else + { //nothing left and this should be unreachable + } + } + } + return(mergecount); +} + +/** + * mergesort the list based on compare + * compare function in form int sorter(void * a,void * b) + * must return >0 for a after b + * must return <0 for a before b + * else 0 + + * NOTE: mergesort changes the mark pointer + */ +void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)) +{ + + dlist_start(list); + struct dlist *listsource, *listdest, *swap; + struct dlist *templist = dlist_new(list->data_size); + unsigned int passcount = 1; + unsigned int mergecount = 1; + // do nothing if there isn't anything to sort + listsource = list; + listdest = templist; + if(listsource->count<2) + { //nothing to do + return; + } + else + { + while(mergecount>0) + { + mergecount=_dlist_merge(listsource, listdest, passcount, compare); + if(mergecount>1) + { + passcount=passcount*2; + //start new pass + swap=listsource; + listsource=listdest; + listdest=swap; + } + } + } + // now put the input list pointers right + // list pointers = newlist pointers + // including the forward and next nodes prev and back pointers + if(list->count==0) + {//copy + list->marker = listdest->marker; + list->count = listdest->count; + list->data_size = listdest->data_size; + list->del_func = listdest->del_func; + list->head->prev = listdest->head->prev; + list->head->next = listdest->head->next; + list->head->data = listdest->head->data; + list->head->next->prev=list->head; + list->head->prev->next=list->head; + templist->head->next=NULL; + templist->head->prev=NULL; + templist->count=0; + } + else + {// no need to copy + + } + + dlist_destroy(templist); +} + + + +/* internal use function + swaps elements a and b + No sense in juggling node pointers when we can just swap the data pointers +*/ + +void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b) +{ + + void *swap=a->data; + a->data=b->data; + b->data=swap; + +} + diff --git a/hald/linux/libsysfs/dlist.h b/hald/linux/libsysfs/dlist.h index b32723b9..9e3a6c96 100644 --- a/hald/linux/libsysfs/dlist.h +++ b/hald/linux/libsysfs/dlist.h @@ -74,7 +74,7 @@ void *_dlist_mark_move(Dlist *list,int direction); void *dlist_mark(Dlist *); void dlist_start(Dlist *); void dlist_end(Dlist *); - +void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction); void *dlist_insert(Dlist *,void *,int) ; void *dlist_insert_sorted(struct dlist *list, void *new_elem, int (*sorter)(void *, void *)); @@ -92,7 +92,15 @@ void *dlist_shift(Dlist *); void dlist_destroy(Dlist *); +int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)); + void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)); + +void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)); + + +void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b); + void dlist_transform(struct dlist *list, void (*node_operation)(void *)); @@ -101,6 +109,7 @@ void dlist_transform(struct dlist *list, void (*node_operation)(void *)); * _dlist_mark_move is for internal use only */ void *_dlist_remove(struct dlist *,struct dl_node *,int ); +void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction); #define dlist_prev(A) _dlist_mark_move((A),0) #define dlist_next(A) _dlist_mark_move((A),1) diff --git a/hald/linux/libsysfs/sysfs.h b/hald/linux/libsysfs/sysfs.h index 4ef8c287..785ef9c7 100644 --- a/hald/linux/libsysfs/sysfs.h +++ b/hald/linux/libsysfs/sysfs.h @@ -37,6 +37,7 @@ extern int isascii(int c); /* Debugging */ +#define DEBUG #ifdef DEBUG #define dprintf(format, arg...) fprintf(stderr, format, ## arg) #else diff --git a/hald/linux/libsysfs/sysfs_dir.c b/hald/linux/libsysfs/sysfs_dir.c index ae6f3428..61ea85ed 100644 --- a/hald/linux/libsysfs/sysfs_dir.c +++ b/hald/linux/libsysfs/sysfs_dir.c @@ -105,7 +105,7 @@ static int dir_subdir_name_equal(void *a, void *b) void sysfs_close_attribute(struct sysfs_attribute *sysattr) { if (sysattr != NULL) { - if (sysattr->value != NULL) + if (sysattr->value != NULL && sysattr->value[0] != '\0') /* davidz: latter is a stopgap fix */ free(sysattr->value); free(sysattr); } @@ -513,9 +513,9 @@ struct sysfs_link *sysfs_open_link(const char *linkpath) safestrcpy(ln->path, linkpath); if ((sysfs_get_name_from_path(linkpath, ln->name, SYSFS_NAME_LEN)) != 0 || (sysfs_get_link(linkpath, ln->target, SYSFS_PATH_MAX)) != 0) { + sysfs_close_link(ln); errno = EINVAL; dprintf("Invalid link path %s\n", linkpath); - free (ln); return NULL; } @@ -885,7 +885,8 @@ struct sysfs_attribute *sysfs_get_directory_attribute attr = (struct sysfs_attribute *)dlist_find_custom (dir->attributes, attrname, dir_attribute_name_equal); if (attr != NULL) { - if ((sysfs_read_attribute(attr)) != 0) { + if ((attr->method & SYSFS_METHOD_SHOW) && + (sysfs_read_attribute(attr)) != 0) { dprintf("Error reading attribute %s\n", attr->name); return NULL; } diff --git a/hald/linux/pci_bus_device.c b/hald/linux/pci_bus_device.c index bde3def9..f3a8b21b 100644 --- a/hald/linux/pci_bus_device.c +++ b/hald/linux/pci_bus_device.c @@ -410,7 +410,7 @@ pci_device_pre_process (BusDeviceHandler *self, dlist_for_each_data (sysfs_get_device_attributes (device), cur, struct sysfs_attribute) { - if (cur == NULL || cur->path == NULL || cur->value == NULL) + if (cur == NULL || cur->path == NULL || cur->value == NULL || strlen (cur->value) == 0) continue; if (sysfs_get_name_from_path (cur->path, |