equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
73 } |
73 } |
74 |
74 |
75 /** |
75 /** |
76 * Returns object to iterate over the mount entries in the given fstab file. |
76 * Returns object to iterate over the mount entries in the given fstab file. |
77 */ |
77 */ |
78 Iterable<UnixMountEntry> getMountEntries(String fstab) { |
78 List<UnixMountEntry> getMountEntries(String fstab) { |
79 ArrayList<UnixMountEntry> entries = new ArrayList<>(); |
79 ArrayList<UnixMountEntry> entries = new ArrayList<>(); |
80 try { |
80 try { |
81 long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r")); |
81 long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r")); |
82 try { |
82 try { |
83 for (;;) { |
83 for (;;) { |
99 |
99 |
100 /** |
100 /** |
101 * Returns object to iterate over the mount entries in /etc/mtab |
101 * Returns object to iterate over the mount entries in /etc/mtab |
102 */ |
102 */ |
103 @Override |
103 @Override |
104 Iterable<UnixMountEntry> getMountEntries() { |
104 List<UnixMountEntry> getMountEntries() { |
105 return getMountEntries("/etc/mtab"); |
105 return getMountEntries("/etc/mtab"); |
106 } |
106 } |
107 |
107 |
108 |
108 |
109 |
109 |