FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 05-14-2012, 07:53 AM
"Walter Dnes"
 
Default Stability of /sys api

After some Google-searching, I think I've figured out how to implement
automounting under mdev. I'd like to put in as much sanity-checking
into the script as possible. Right now I have 1 USB stick plugged in as
/dev/sdb. Th hard drive is /dev/sda. The "removable" data is readable
like so...

cat /sys/block/sda/removable
0

cat /sys/block/sdb/removable
1

My question... is this API stable or deprecated? I.e. can I count on
it being around for a while? I figure this question is a developer type
question rather than ordinary user type.

--
Walter Dnes <waltdnes@waltdnes.org>
 
Old 05-14-2012, 08:43 AM
Brian Harring
 
Default Stability of /sys api

On Mon, May 14, 2012 at 03:53:53AM -0400, Walter Dnes wrote:
> After some Google-searching, I think I've figured out how to implement
> automounting under mdev. I'd like to put in as much sanity-checking
> into the script as possible. Right now I have 1 USB stick plugged in as
> /dev/sdb. Th hard drive is /dev/sda. The "removable" data is readable
> like so...
>
> cat /sys/block/sda/removable
> 0
>
> cat /sys/block/sdb/removable
> 1
>
> My question... is this API stable or deprecated? I.e. can I count on
> it being around for a while? I figure this question is a developer type
> question rather than ordinary user type.

Api is stable although last I dealt with that crap it was reliant on
chipsets/controllers not sucking and misreporting (mmc in particular
comes to mind, although perhaps the hardware sucks less these days).

Suggest you start studying udev source in addition since your
questions of that sort are likely to be answered there. Aka, most
likely wind up asking udev upstream (likely gregkh assuming he hasn't
killfile'd everyone from that thread).

Now the unfun part; this isn't really the right place to be asking. I
get you're doing this w/ a gentoo intent, but you're dancing that line
mightily fine. People asking "can I safely use nested context
managers in python2.6" even if it's orientated towards a potential
gentoo bit (say the ephemeral gentoo stats project), typically will be
told "dunno. Ask the people who wrote the damn thing".

Point there is that the ml shouldn't be used as tech help for the guts
of "I don't want udev and am trying to replace it with mdev";
pkgcore nor paludis internal questions don't come here (format does
since this is the appropriate venue) under the same logic. Forums
come to mind, or appropriate upstreams as mentioned.

Barring that, use the source luke, and start reading the lkml. If
you're trying to do this, you'll likely need to track discussions
there.

Not trying to be a dick mind you, and perhaps others view othewise,
but this isn't the place for it nor do I suspect people care to see
more of this particular war play out on our ml.

~harring
 
Old 05-14-2012, 04:09 PM
Mike Frysinger
 
Default Stability of /sys api

On Monday 14 May 2012 03:53:53 Walter Dnes wrote:
> My question... is this API stable or deprecated? I.e. can I count on
> it being around for a while? I figure this question is a developer type
> question rather than ordinary user type.

if userspace is relying on stuff in /sys, then it's part of the ABI
-mike
 
Old 05-14-2012, 04:31 PM
James Cloos
 
Default Stability of /sys api

WD> cat /sys/block/sda/removable
WD> 0

Note that a 0 there does not imply that the device cannot hotplug.

My USB drive reports 0.

-JimC
--
James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
 
Old 05-14-2012, 04:56 PM
Olivier Crête
 
Default Stability of /sys api

On Mon, 2012-05-14 at 12:31 -0400, James Cloos wrote:
> WD> cat /sys/block/sda/removable
> WD> 0
>
> Note that a 0 there does not imply that the device cannot hotplug.
>
> My USB drive reports 0.

And I'm sure it works fine with udev?

"Those who do not understand udev are condemned to reinvent it, poorly".

--
Olivier Crête
tester@gentoo.org
Gentoo Developer
 
Old 05-14-2012, 05:11 PM
Ciaran McCreesh
 
Default Stability of /sys api

On Mon, 14 May 2012 12:56:39 -0400
Olivier Crête <tester@gentoo.org> wrote:
> On Mon, 2012-05-14 at 12:31 -0400, James Cloos wrote:
> > WD> cat /sys/block/sda/removable
> > WD> 0
> >
> > Note that a 0 there does not imply that the device cannot hotplug.
> >
> > My USB drive reports 0.
>
> And I'm sure it works fine with udev?

I dunno. Internet Explorer broke and now udev won't run.

--
Ciaran McCreesh
 
Old 05-14-2012, 05:59 PM
"Walter Dnes"
 
Default Stability of /sys api

On Mon, May 14, 2012 at 12:31:25PM -0400, James Cloos wrote
> WD> cat /sys/block/sda/removable
> WD> 0
>
> Note that a 0 there does not imply that the device cannot hotplug.
>
> My USB drive reports 0.

You're right. Same for me. Thanks for pointing it out.

--
Walter Dnes <waltdnes@waltdnes.org>
 
Old 05-14-2012, 10:02 PM
James Cloos
 
Default Stability of /sys api

>>>>> "OC" == Olivier Crête <tester@gentoo.org> writes:

OC> And I'm sure it works fine with udev?

It automounts when plugged in, if that is what you mean. (In fact each
partition does; the one in fstab(5) where it should and the one not in
fstab in a mount point based on its label.)

And the dev files get removed when the drive is unplugged.

(unplugged here means either the usb cable or the power cable.)

-JimC
--
James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
 
Old 05-14-2012, 10:06 PM
James Cloos
 
Default Stability of /sys api

>> My USB drive reports 0.

WD> You're right. Same for me. Thanks for pointing it out.

The removable flag specifies whether the drive has removable media;
before flash drives only things like floppy, optical, zip, etc drives
had removable==1. It also would be accurate for flash card readers.
If thumb drives specify it, then they lie.

The flag is read from the drive's metadata.

-JimC
--
James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
 
Old 05-15-2012, 01:17 AM
Greg KH
 
Default Stability of /sys api

On Mon, May 14, 2012 at 12:09:23PM -0400, Mike Frysinger wrote:
> On Monday 14 May 2012 03:53:53 Walter Dnes wrote:
> > My question... is this API stable or deprecated? I.e. can I count on
> > it being around for a while? I figure this question is a developer type
> > question rather than ordinary user type.
>
> if userspace is relying on stuff in /sys, then it's part of the ABI

Yes, but note, you are looking at the wrong thing, what you are reading
isn't really what you think it means...

And to rely on sysfs, you have to be very careful, you can not rely on
position, or files, always being where you saw them yesterday as device
ids, topologies, and other stuff, change all the time.

greg k-h
 

Thread Tools




All times are GMT. The time now is 07:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org