2 * Copyright (C) 1997, 2001, 2003 Free Software Foundation, Inc.
3 * Copyright (C) 2013 Steven McDonald <steven@steven-mcdonald.id.au>
5 * ftpfs translator written by Miles Bader <miles@gnu.org>
6 * Modified for trovefs by Steven McDonald <steven@steven-mcdonald.id.au>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This software is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 #include <hurd/netfs.h>
30 trovefs_create (char *hostname, char *bucket, char *access_key_id, char *secret_access_key, int fsid, struct trovefs **fs)
34 struct trovefs_dir *super_root_dir;
35 struct node *super_root;
36 struct trovefs *new = malloc (sizeof (struct trovefs));
44 s3err = S3_initialize (TROVEFS_USER_AGENT, S3_INIT_ALL, hostname);
49 case S3StatusUriTooLong:
51 case S3StatusInternalError:
53 case S3StatusOutOfMemory:
59 new->s3_ctx = malloc (sizeof (S3BucketContext));
60 new->s3_ctx->hostName = hostname;
61 new->s3_ctx->bucketName = bucket;
62 new->s3_ctx->protocol = S3ProtocolHTTPS;
63 new->s3_ctx->uriStyle = S3UriStyleVirtualHost;
64 new->s3_ctx->accessKeyId = access_key_id;
65 new->s3_ctx->secretAccessKey = secret_access_key;
67 hurd_ihash_init (&new->inode_mappings, offsetof (struct trovefs_dir_entry, inode_locp));
68 pthread_spin_init (&new->inode_mappings_lock, PTHREAD_PROCESS_PRIVATE);
70 super_root = netfs_make_node (0);
74 err = trovefs_dir_create (new, super_root, "/", &super_root_dir);
76 err = trovefs_dir_null_lookup (super_root_dir, &new->root);
80 hurd_ihash_destroy (&new->inode_mappings);