lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 11 Jan 2009 00:35:46 -0500
From:	Jon Masters <jonathan@...masters.org>
To:	joseluismarchetti@...oo.com.br
Cc:	linux-kernel@...r.kernel.org
Subject: Re: How to access a regular file from within a module ?

On Sat, 2009-01-10 at 19:44 -0800, Jose Luis Marchetti wrote:

> I would like to open/read/write/close a regular file from my device
> driver.

No, you probably wouldn't :) Generally, this is recommended against
because there are many better ways to do it:

* Create an interface and have userspace set the parameter (ethtool,
ifconfig - the latter can already set MAC addresses)

* Create entries in sysfs and have uevents cause various activities,
including having the response being some file gets loaded (firmware).

Since it looks like you just want to set the MAC address, I suggest
looking at how this is already done, then rely upon users using ifconfig
correctly to set the desired address. There should be no reason to have
a kernel-side network driver reading from a file.

[NOTE: If you're doing embedded development and you don't have an EEPROM
on your board, and you're asking this because someone told you to find
the cheapest and nastiest solution in software, then look at passing in
the desired MAC via the firmware, as many embedded boards already do. ]

Jon.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ