From: "Kay Sievers" Date: Mon, 27 Nov 2006 15:52:10 +0000 Subject: Re: [Patch] udev: new dasd_id tool Message-Id: <3ae72650611270752kc15cfcaw606c686b4147edd7@mail.gmail.com> List-Id: References: <20061127141551.406c28a1.sameske@de.ibm.com> In-Reply-To: <20061127141551.406c28a1.sameske@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On 11/27/06, Volker Sameske wrote: > > The currently used uid (volume label) for s390 DASD devices is not really > unique. For that reason a unique uid sysfs-attribute for DASD devices has > been introduced. This new dasd_id tool replaces the current one and > evaluates this new sysfs attribute. In case it is not available, dasd_id > returns the old volume label instead. > etc/udev/debian/persistent.rules | 2 > etc/udev/redhat/50-udev.rules | 2 > etc/udev/slackware/udev.rules | 2 > etc/udev/suse/60-persistent-storage.rules | 2 You can't patch any of these rules, they are usually copies _from_ the distro as examples, not _to_ the distro. > - * This program is free software; you can redistribute it and/or mod= ify it > - * under the terms of the GNU General Public License as published by= the > - * Free Software Foundation version 2 of the License. Why do you want to remove the license? > - value =3D getenv("UDEV_LOG"); > - if (value) > - udev_log =3D log_priority(value); > - else > - udev_log =3D LOG_ERR; Why don't we want that anymore? > +static int dinfo_create_devnode(dev_t dev, char** devno) > +{ > + char* result; > + char* pathname[] =3D { "/dev", getenv("TMPDIR"), "/tmp", > + getenv("HOME"), "." , "/"}; What's are you trying to fight here? That's absolutely not needed, just let udev provide you a temporary node, or use /dev, which is obviously always writable in a udev setup. > + sprintf(tmp,"/sys/bus/ccw/devices/%s/", busid); > + directory =3D opendir(tmp); You can't reference /sys/bus/ directly, look at udev_sysfs.c, how to do it. > + while ((dir_entry =3D readdir(directory)) !=3D NULL) { > + if (strncmp(dir_entry->d_name, "block:", 6) =3D 0) { You can't use these links, they will go away some day. > + sscanf(uname_buf.release, "%d.%d", &version,&release); > + if (strcmp(uname_buf.sysname,"Linux") || > + version < 2 || release < 6) { No need for that, there is no udev for kernels < 2.6. Instead of all that, can't you just read the values from sysfs with udev using $attr{} in a rule, and possibly fall back to the old tool only if you don't find the values there? Thanks, Kay ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel