1 /* 2 * A resource supporting the creation of user-specific ext2 filesystem opener 3 * resources. 4 * 5 * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA 21 */ 22 23 #include "ext2_file_opener.h" 24 #include "ext2_filesystem.h" 25 #include "resource_server.h" 26 27 /* Return a file opener object for the given user. */ 28 29 long Ext2Filesystem::open_for_user(sys_uid_t uid, sys_gid_t gid, 30 sys_mode_t umask, l4_cap_idx_t *ref) 31 { 32 user_t user = (user_t) {uid, gid, umask}; 33 Resource *resource = new Ext2FileOpener(this, _fs, user); 34 35 /* Complete the initialisation and start a server in a new thread. 36 If the thread does not start, the resource will be finalised. */ 37 38 return ResourceServer(resource).start_thread(ref); 39 } 40 41 // vim: tabstop=4 expandtab shiftwidth=4