Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Requêtes de fusion
!7
Database fuse
Code
Examiner les modifications
Extraire la branche
Télécharger
Correctifs
Diff brut
Étendre la barre latérale
Fermé
Database fuse
database-fuse
vers
master
Vue d'ensemble
1
Validations
3
Pipelines
0
Modifications
2
Fermé
Kubat
a demandé de fusionner
database-fuse
vers
master
Il y a 5 ans
Vue d'ensemble
1
Validations
3
Pipelines
0
Modifications
2
On peut monter la db avec fuse pour stocker les karas de manière centralisée.
Création de dossiers pour la création de playlists
Le
ln
/
touch
/qqchose peut ajouter des karas à des playlists
La lecture de fichiers permet de lire des karas (qui sont contenus en tant que blobs dans la db)
La lecture de dossiers permet de lire le contenue de playlists / de la base
Modification effectuée
Il y a 5 ans
par
Kubat
0
0
Rapports de requête de fusion
Comparer
master
version 2
6ab46240
Il y a 5 ans
version 1
00e2d95d
Il y a 5 ans
master (base)
et
dernière version
dernière version
6ab46240
3 validations,
Il y a 5 ans
version 2
6ab46240
30 validations,
Il y a 5 ans
version 1
00e2d95d
28 validations,
Il y a 5 ans
2 files
+
207
−
3
En ligne
Comparer les modifications
Côte à côte
En ligne
Afficher les modifications des espaces
Afficher un fichier à la fois
Fichiers
2
player/src/db/lektor_fuse.c
0 → 100644
+
198
−
0
Afficher le fichier @ 6ab46240
#include
"sqlite3.h"
#define FUSE_USE_VERSION 31
#define _GNU_SOURCE
#include
<fuse3/fuse.h>
#include
<stdio.h>
#include
<string.h>
#include
<errno.h>
#include
<fcntl.h>
#include
<stddef.h>
#include
<assert.h>
#include
<dirent.h>
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<unistd.h>
#include
<strings.h>
static
volatile
const
char
*
database_path
=
NULL
;
/**<< @brief The path to the database. */
static
volatile
const
char
*
database
=
NULL
;
/**<< @brief The database that contains all the karas. */
static
void
*
lektor_init
(
struct
fuse_conn_info
*
conn
,
struct
fuse_config
*
cfg
)
{
(
void
)
conn
;
(
void
)
cfg
;
if
(
sqlite3_open
((
const
char
*
)
database_path
,
(
sqlite3
**
)
&
database
)
!=
0
)
{
fprintf
(
stderr
,
"[LEKTOR_FUSE] error while opening database <%s>
\n
"
,
database_path
);
}
return
NULL
;
}
static
int
lektor_getattr
(
const
char
*
path
,
struct
stat
*
stbuf
,
struct
fuse_file_info
*
info
)
{
(
void
)
info
;
int
res
=
-
ENOENT
;
memset
(
stbuf
,
0
,
sizeof
(
struct
fuse_file_info
));
size_t
length
=
strlen
(
path
);
if
(
length
==
1
&&
strncmp
(
path
,
"/"
,
1
)
==
0
)
{
stbuf
->
st_mode
=
S_IFDIR
|
0755
;
stbuf
->
st_nlink
=
2
;
return
0
;
}
else
if
(
strncmp
(
path
,
"/playlists"
,
10
)
==
0
)
{
if
(
length
==
10
)
{
// The directory otself
stbuf
->
st_mode
=
S_IFDIR
|
0777
;
stbuf
->
st_nlink
=
2
;
return
0
;
}
else
if
(
strncmp
(
path
+
10
,
"/README"
,
7
)
==
0
)
{
stbuf
->
st_mode
=
S_IFREG
|
0444
;
stbuf
->
st_nlink
=
1
;
return
0
;
}
}
else
if
(
strncmp
(
path
,
"/authors"
,
8
)
==
0
)
{
if
(
length
==
8
)
{
// The directory itself
stbuf
->
st_mode
=
S_IFDIR
|
0755
;
stbuf
->
st_nlink
=
2
;
return
0
;
}
else
if
(
strncmp
(
path
+
8
,
"/README"
,
7
)
==
0
)
{
stbuf
->
st_mode
=
S_IFREG
|
0444
;
stbuf
->
st_nlink
=
1
;
return
0
;
}
}
else
{
res
=
-
ENOENT
;
}
return
res
;
}
// static int lektor_mkdir(const char * path, mode_t mode)
// {
// }
//
//
// static int lektor_rmdir(const char * path)
// {
// }
static
int
lektor_read
(
const
char
*
path
,
char
*
buf
,
size_t
size
,
off_t
offset
,
struct
fuse_file_info
*
info
)
{
(
void
)
info
;
(
void
)
offset
;
(
void
)
size
;
size_t
length
=
strlen
(
path
);
if
(
length
>
strlen
(
"README"
)
&&
strncmp
(
path
+
(
length
-
6
),
"README"
,
6
)
==
0
)
{
memcpy
(
buf
,
"sample readme"
,
strlen
(
"sample readme"
));
return
0
;
}
else
{
return
-
ENOENT
;
}
}
// static int lektor_open(const char * path, struct fuse_file_info * info)
// {
// }
static
int
lektor_readdir
(
const
char
*
path
,
void
*
buf
,
fuse_fill_dir_t
filler
,
off_t
offset
,
struct
fuse_file_info
*
fi
,
enum
fuse_readdir_flags
flags
)
{
(
void
)
offset
;
(
void
)
fi
;
(
void
)
flags
;
size_t
length
=
strlen
(
path
);
if
(
length
==
0
||
path
[
0
]
!=
'/'
)
{
return
-
ENOENT
;
}
filler
(
buf
,
"."
,
NULL
,
0
,
0
);
filler
(
buf
,
".."
,
NULL
,
0
,
0
);
path
++
;
// Skip the first '/'
length
--
;
// Skip the first '/'
struct
stat
simple_readonly
=
{
.
st_mode
=
S_IFREG
|
0444
,
.
st_uid
=
0
,
.
st_gid
=
0
,
};
if
(
length
==
0
)
{
/* We are in the root directory */
filler
(
buf
,
"playlists"
,
NULL
,
0
,
0
);
filler
(
buf
,
"authors"
,
NULL
,
0
,
0
);
}
else
if
(
length
==
7
&&
strncmp
(
path
,
"authors"
,
7
)
==
0
)
{
filler
(
buf
,
"README"
,
&
simple_readonly
,
0
,
0
);
}
else
if
(
length
==
9
&&
strncmp
(
path
,
"playlists"
,
9
)
==
0
)
{
filler
(
buf
,
"README"
,
&
simple_readonly
,
0
,
0
);
}
else
{
return
-
ENOENT
;
}
return
0
;
}
static
void
lektor_deinit
(
void
*
ptr
)
{
(
void
)
ptr
;
if
(
database
==
NULL
)
{
return
;
}
sqlite3_close
((
sqlite3
*
)
database
);
}
static
struct
fuse_operations
lektor_oper
=
{
.
init
=
lektor_init
,
.
destroy
=
lektor_deinit
,
.
getattr
=
lektor_getattr
,
// .open = lektor_open,
.
read
=
lektor_read
,
// .mkdir = lektor_mkdir,
// .rmdir = lektor_rmdir,
.
readdir
=
lektor_readdir
,
};
int
main
(
int
argc
,
char
*
argv
[])
{
struct
fuse_args
args
=
FUSE_ARGS_INIT
(
argc
,
argv
);
return
fuse_main
(
args
.
argc
,
args
.
argv
,
&
lektor_oper
,
NULL
);
}
Chargement en cours