On Tue, Jan 23, 2018 at 5:35 PM, Matrix Neo <
lanxis...@gmail.com> wrote:
> Lan,
> Thank you for your reply. Yes, I'm using GNU/Linux. I lookup the
> findmnt program your mentioned and find that doesn't meet the need.
> For example, if /data is mounted on /dev/sda3 and the given dir is /data.
> It's ok to use findmnt to get /dev/sda3. But if the given dir is
> /data/test1,
> the findmnt returns nothing.
Sorry the suggestion didn't help, but in any case this is a GNU/Linux
question, not a Go question as such.
Ian
> 在 2018年1月23日星期二 UTC+8下午10:39:58,Ian Lance Taylor写道:
>>
>> On Mon, Jan 22, 2018 at 10:11 PM, Matrix Neo <
lanxis...@gmail.com> wrote:
>> >
>> > I want to get the mount point or device name (like /dev/sda1) by
>> > the
>> > directory name. I try my best only to find syscall.Stat_t struct but
>> > there
>> > is no field to
>> > point the information i need. So is there any way to implement this ?
>>
>> You neglected to say what kind of system you are running on. If you
>> are using GNU/Linux, then as far as I know this information is not
>> available using `stat`. You need to run the `findmnt` program or look
>> in `/proc/self/mountinfo`.
>>
>> Ian
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.